home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Mac OS USB DDK_v1.0.1 / Examples / PrinterClassDriver / Chooser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-03  |  2.4 KB  |  74 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Chooser.h
  3.  
  4.     Contains:    Header file for Chooser PACK code to support USB and serial printers
  5.  
  6. */
  7. #ifndef __Chooser__
  8. #define __Chooser__
  9. #define    kUSBModelPathString        1000
  10. #define    kUSBPrinterPathString    2000
  11. #define    kPrinterNameString        2100
  12.  
  13. #ifndef __TYPES__
  14. #include <Types.h>
  15. #endif
  16.  
  17. #include <CodeFragments.h>
  18.  
  19. typedef struct
  20. {
  21. // address of name registry routines
  22.     ProcPtr        RegistryEntryIDInitAddr;
  23.     ProcPtr        RegistryCStrEntryLookupAddr;
  24.     ProcPtr        RegistryEntryIterateCreateAddr;
  25.     ProcPtr        RegistryEntryIterateDisposeAddr;
  26.     ProcPtr        RegistryEntryIterateSetAddr;
  27.     ProcPtr        RegistryEntryIterateAddr;    
  28.     ProcPtr        RegistryEntryIDDisposeAddr;    
  29.     ProcPtr        RegistryPropertyGetAddr;
  30.  
  31.     CFragConnectionID sCID;                    // our connection id to the name registry library
  32.  
  33.     Boolean        hasNameRegistry;            // does this cpu have a name registry
  34.     Boolean        checkedForNameRegistry;        // did we check for the name registry already
  35.  
  36.     short        numberOfPrinters;            // total number of printers listed (unused for now)
  37.     short        numberOfUSBPrinters;        // total number of USB printers
  38.     short        numberOfPorts;                // total number of serial ports (0-if we don't support serial)
  39.  
  40.     Boolean        supportsSerial;                // do we support serial
  41.     Boolean        supportsUSB;                // do we support USB
  42. // holds index into our STR# rsrc (name registry model path) for each entry in the printer list
  43.     short*        modelIndex;
  44. } USBGlobals, *USBGlobalsPtr, **USBGlobalsHandle;
  45.  
  46. typedef    struct
  47. {
  48.     unsigned short    branch;        // Branch instruction.
  49.     unsigned short    devID;        // Device ID.
  50.     OSType            resType;    // Resource type (always 'PACK').
  51.     short            resID;        // Resource ID (always -4096).
  52.     short            version;    // Printer driver version.
  53.     unsigned long    flags;        // Flag bits.
  54.     long int        storage;    // our storage
  55.     Str31            driverName;    // Name of printer driver.
  56.     char            code[1];    // PACK code starts here.
  57. } ChooserPACKHeader, *ChooserPACKHeaderPtr, **ChooserPACKHeaderHdl;
  58.                                         
  59. // description of the connection rsrc CTYP
  60. typedef struct
  61. {
  62.     short    selectedType;        // connection type of the selected printer
  63.     short    supportsSerial;        // do we support serial
  64.     short    supportsUSB;        // do we support USB
  65. } ConnectionType, *ConnectionTypePtr, **ConnectionTypeHdl;
  66.  
  67. extern    OSErr    InitGlobalStorage(void);
  68. extern    void    RemoveGlobalStorage(void);
  69. extern    USBGlobalsHandle    GetGlobalStorage(void);
  70. extern    pascal OSErr Chooser(    short message, short caller, StringPtr objName,
  71.                         StringPtr zoneName, long p1, long p2    );
  72.  
  73. #endif
  74.